<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>查询电表数据列表</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css" href="../bootstrap/dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" href="../css/fileinput.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/public.css" />
	</head>
	<style type="text/css">
		.remove {
			cursor: pointer;
		}
		
		.remove:hover {
			/*color: red;*/
		}
		
		.pagination span {
			font: 14px/34px "";
			padding: 0 5px;
		}
		
		.form-control {
			display: inline-block;
			width: 120px;
		}
		
		.search {
			width: 155px;
		}
		
		.header {
			/*border-bottom: 1px solid #fefefe;*/
		}
		
		.header span {
			padding: 0 5px;
		}
		
		ul {
			display: block;
			list-style-type: disc;
			margin-block-start: 0em;
			margin-block-end: 0em;
			margin-inline-start: 0px;
			margin-inline-end: 0px;
			padding-inline-start: 0px;
		}
		
		li {
			list-style-type: none;
			display: flex;
			justify-content: flex-start;
			border-bottom: 1px solid #ebebeb;
			font: 14px/28px "";
		}
		
		li span {
			display: inline-block;
			width: 20%;
		}
		
		.table_cla {
			height: 560px;
		}
	</style>

	<body>
		<div id="app" style="width: 100%; margin: 0 auto;padding:0 20px;">
			<div class="header" style="margin-top: 20px;">
				<!--<span>楼宇：</span>-->
				<select name="" class="form-control" v-model="build_model" @change="buildchange">
					<option v-for="index in build" :value="index.id" v-text="index.buildname"></option>
				</select>
				<!--<span>单元：</span>-->
				<select name="" class="form-control" v-model="unit_model" @change="unitchange">
					<option v-for="index in unit" :value="index.id" v-text="index.unitname"></option>
				</select>
				<!--<span>楼层：</span>-->
				<select name="" class="form-control" v-model="floor_model" @change="floorchange">
					<option v-for="index in floor" :value="index.id" v-text="index.floorname"></option>
				</select>
				<!--<span>房号：</span>-->
				<select name="" class="form-control" v-model="room_model">
					<option v-for="index in room" :value="index.rommid" v-text="index.rommcode"></option>
				</select>
				<!--<select name="" class="form-control" v-model="rechresult">
					<option v-for="index in leixing" :value="index.id" v-text="index.name"></option>
				</select>-->
				<input style="width: 155px;" type="text" class="form-control" name="search1" id="search1" value="" v-model="searchmain" placeholder="请输入电表号或房号" />
				<button type="button" class="btn btn-info" @click="search">搜索</button>
				<button type="button" class="btn btn-info" data-toggle="modal" data-target="#add_ele_meter" @click="add_ele_meter">增加电表</button>
				<button type="button" class="btn btn-info" @click="grou_read_meter">群读电表</button>
			</div>
			<div class="table_cla">
				<table class="table">
					<caption>查询电表数据列表</caption>
					<thead>
						<tr>
							<th>楼宇名称</th>
							<th>单元号</th>
							<th>楼层</th>
							<th>房间号</th>
							<th>业主</th>
							<th>表号</th>
							<th>表具类型</th>
							<th>安装位置</th>
							<th>安装时间 </th>
							<th>倍率</th>
							<th>开户状态</th>
							<!--<th>是否设置电价</th>-->
							<th>详情 </th>
						</tr>
					</thead>
					<tbody>
						<tr v-for="(tt,index) in table">
							<td v-text="tt.buildname"></td>
							<td v-text="tt.units"></td>
							<td v-text="tt.floor"></td>
							<td v-text="tt.rommcode"></td>
							<td v-text="tt.custname"></td>
							<td v-text="tt.watchno"></td>
							<td v-text="tt.watchtype"></td>
							<td v-text="tt.instadr"></td>
							<td v-text="tt.instdate"></td>
							<td v-text="tt.rate"></td>
							<td v-text="tt.accountstate"></td>
							<!--<td v-text="tt.issetprice"></td>-->
							<td class="remove">
								<span v-if="panduan" data-toggle="modal" data-target="#myModalremove" style="color: #286090;" @click="sure_more(tt)" class="glyphicon glyphicon-align-justify">详情&nbsp;</span>
								<span v-if="panduan" @click="fix_ele_meter(tt)" data-toggle="modal" data-target="#fix_ele_meter" style="color: #f0ad4e;" class="glyphicon glyphicon-pencil">修改&nbsp;</span>
								<span v-if="panduan" data-toggle="modal" data-target="#remove_ele_meter" @click="remove_ele_meter(tt)" style="color: #d43f3a;" class="glyphicon glyphicon-trash">删除&nbsp;</span>
								<span v-if="panduan" @click="replace_ele_meter(tt)" data-toggle="modal" data-target="#replace_ele_meter" style="color: #5bc0de;" class="glyphicon glyphicon-refresh">换表&nbsp;</span>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<ul class="pagination">
				<span v-text="count_all"></span>
				<!--<li v-show="current != 1" @click="current-- && goto(current--)">
					<a href="#">上一页</a>
				</li>-->
				<li v-for="index in pages" @click="goto(index)" :class="{'active':current == index}" :key="index">
					<a href="#" v-text="index"></a>
				</li>
				<!--<li v-show="allpage != current && allpage != 0 " @click="current++ && goto(current++)">
					<a href="#">下一页</a>
				</li>-->
				<span>跳到:</span>
				<!--<input style="width: 50px;height: 34px;" min="1" max="{{allpage}}" type="number" name="goto" id="goto" v-model="jump" />-->
				<input style="width: 50px;height: 28px;" name="goto" id="goto" v-model="jump" type="text" oninput="value=value.replace(/[^\d]/g,'')">
				<span>页</span>
				<button type="button" id="gotoo" @click="goto(jump)" class="btn btn-danger ">确定 </button>
			</ul>
			<!--增加电表模态框-->
			<div class="modal fade" id="add_ele_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">添加电表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*选择楼宇：</span>
									<select name="" v-model="build_model" class="form-control" @change="buildchange">
										<option v-for="index in build" :value="index.id" v-text="index.buildname"></option>
									</select>
								</li>
								<li>
									<span>*选择单元：</span>
									<select name="" class="form-control" v-model="unit_model" @change="unitchange">
										<option v-for="index in unit" :value="index.id" v-text="index.unitname"></option>
									</select>
								</li>
								<li>
									<span>*选择楼层：</span>
									<select name="" class="form-control" v-model="floor_model" @change="floorchange">
										<option v-for="index in floor" :value="index.id" v-text="index.floorname"></option>
									</select>
								</li>
								<li>
									<span>*选择房号：</span>
									<select name="" class="form-control" v-model="room_model">
										<option v-for="index in room" :value="index.rommid" v-text="index.rommcode"></option>
									</select>
								</li>
								<li>
									<span>*厂商名称：</span>
									<select id="vendor_name_fix" v-model="vendor" style="display: inline-block;" class="form-control">
										<option v-for="item in vendor_name" :value="item.itemname" v-text="item.itemname"></option>
									</select>
								</li>
								<li>
									<span>*mac地址：</span>
									<select id="" v-model="add_data.macadderid" style="display: inline-block;" class="form-control">
										<option v-for="item in mac_name" :value="item.macadderid" v-text="item.boardname"></option>
									</select>
								</li>

								<li>
									<span>*安装时间：</span>
									<input class="time-input form-control" type="text" placeholder="点击选择安装时间" id="datetimepicker" v-model="add_data.instdate">
								</li>
								<li>
									<span>*安装位置：</span>
									<input type="text" placeholder="请输入安装位置" v-model="add_data.instadr">
								</li>
								<li>
									<span>*IP地址：</span>
									<input type="text" placeholder="请输入IP地址" v-model="add_data.ipadder">
								</li>
								<li>
									<span>*端口号：</span>
									<input type="text" placeholder="请输入端口号" v-model="add_data.port">
								</li>
								<li>
									<span>*新表表号：</span>
									<input type="text" placeholder="请输入新表表号" v-model="add_data.watchno">
								</li>
								<li>
									<span>初始余额：</span>
									<input type="number" placeholder="请输入初始余额" v-model="add_data.initsum">
								</li>
								<!--<li>
									<span>表读数：</span>
									<input class="form-control" type="text" v-model="add_data.lastreadnum"  placeholder="请输入表读数" />
								</li>-->
								<li>
									<span>旧表表号：</span>
									<input class="form-control" type="text" v-model="add_data.oldwatchno" placeholder="之前有表请输入旧表号" />
								</li>
								<li>
									<span>旧表照片：</span>
								</li>
								<form id="Form1" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile" name="pic" type="file" class="file">
								</form>
								<li>
									<span>*表类型：</span>
									<select id="" v-model="watchtype" style="display: inline-block;" class="form-control">
										<option value="">请选择计费类型</option>
										<option value="1">单项</option>
										<option value="2">三项</option>

										<!-- <option v-for= 'item in jifei' :value="item.id" v-text='item.value'></option>																		 -->
									</select>
								</li>
								<li v-if="watchtype==2">
									<span>*倍率：</span>
									<input class="form-control" type="number" v-model="add_data.rate" placeholder="请输入电表倍率" />
								</li>
								<li>
									<span>换表备注：</span>
									<!--<input type="text" placeholder="如果之前有旧表请输入备注！" v-model="add_data.remarks"/>-->
									<textarea name="" v-model="add_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="add_ele_meter_sure" class="btn btn-danger remove" @click="add_ele_meter_sure">确定添加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!--修改电表模态框-->
			<div class="modal fade" id="fix_ele_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">修改电表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*mac地址：</span>
									<select id="" v-model="fix_data.macadderid" style="display: inline-block;" class="form-control">
										<option v-for="item in mac_name" :value="item.macadderid" v-text="item.boardname"></option>
									</select>
								</li>
								<li>
									<span>*安装位置：</span>
									<input type="text" placeholder="请输入安装位置" v-model="fix_data.instadr">
								</li>
								<li>
									<span>*IP地址：</span>
									<input type="text" placeholder="请输入IP地址" v-model="fix_data.ipadder">
								</li>
								<li>
									<span>*端口号：</span>
									<input type="text" placeholder="请输入端口号" v-model="fix_data.port">
								</li>
								<!--<li>
									<span>*新表表号：</span>
									<input type="text" placeholder="请输入新表表号" v-model="fix_data.watchno">
								</li>-->
								<!--<li>
									<span>旧表表号：</span>
									<input class="form-control" type="text" v-model="fix_data.oldwatchno" placeholder="之前有表请输入旧表号" />
								</li>
								<li>
									<span>旧表照片：</span>
								</li>
								<form id="Form2" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile1" name="pic" type="file" class="file">
								</form>-->
								<li v-if="watchtype1==2">
									<span>*倍率：</span>
									<input class="form-control" type="number" v-model="fix_data.rate" placeholder="请输入电表倍率" />
								</li>
								<li>
									<span>换表备注：</span>
									<!--<input type="text" placeholder="如果之前有旧表请输入备注！" v-model="add_data.remarks"/>-->
									<textarea name="" v-model="fix_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="fix_ele_meter_sure" class="btn btn-danger remove" @click="fix_ele_meter_sure">确定修改</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!--更换电表模态框-->
			<div class="modal fade" id="replace_ele_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">更换电表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*新表表号：</span>
									<input type="text" placeholder="请输入新表表号" v-model="replace_data.watchno">
								</li>
								<li>
									<span>初始余额：</span>
									<input type="number" placeholder="请输入初始余额" oninput="value=value.replace(/[^\d]/g,'')" v-model="replace_data.initsum">
								</li>
								<!--<li>
									<span>旧表表号：</span>
									<input class="form-control" type="text" v-model="replace_data.oldwatchno" placeholder="之前有表请输入旧表号" />
								</li>-->
								<li>
									<span>旧表照片：</span>
								</li>
								<form id="Form2" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile1" name="pic" type="file" class="file">
								</form>
								<li>
									<span>换表备注：</span>
									<textarea name="" placeholder="请输入换表备注" v-model="replace_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="replace_ele_meter_sure" class="btn btn-danger remove" @click="replace_ele_meter_sure">确定更换</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）详情  -->
			<div class="modal fade" id="myModalremove" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">电表数据详情</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>表具id:</span><label v-text="model_data.equipsid"></label>
								</li>
								<li>
									<span>创建时间:</span><label v-text="model_data.createdate"></label>
								</li>
								<li>
									<span>厂商名 :</span><label v-text="model_data.factoryid"></label>
								</li>
								<li>
									<span>ip地址 :</span><label v-text="model_data.ipadder"></label>
								</li>
								<li>
									<span>端口号 :</span><label v-text="model_data.port"></label>
								</li>
								<li>
									<span>mac地址 :</span><label v-text="model_data.boardname"></label>
								</li>
								<li>
									<span>最大功率 : </span><label v-text="model_data.powerlimit"></label>
								</li>

								<li v-if="model_data.ladder1">
									<span>阶梯一:</span><label v-text="model_data.ladder1"></label>
								</li>
								<li v-if="model_data.ladder2">
									<span>阶梯二:</span><label v-text="model_data.ladder2"></label>
								</li>
								<li v-if="model_data.ladder3">
									<span>阶梯三:</span><label v-text="model_data.ladder3"></label>
								</li>

								<li v-if="model_data.price1">
									<span>阶梯价格 1:</span><label v-text="model_data.price1"></label>
								</li>
								<li v-if="model_data.price2">
									<span>阶梯价格 2:</span><label v-text="model_data.price2"></label>
								</li>
								<li v-if="model_data.price3">
									<span>阶梯价格 3:</span><label v-text="model_data.price3"></label>
								</li>
								<li v-if="model_data.price4">
									<span>阶梯价格 4:</span><label v-text="model_data.price4"></label>
								</li>
								<li>
									<span>备注：</span><textarea disabled="disabled" v-text="model_data.remarks"></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" @click="read_metera_action" data-toggle="modal" data-target="#read_ele_meter" class="btn btn-info">读电表</button>
							<button type="button" data-toggle="modal" data-target="#set_powerlimit" class="btn btn-info">设置电表功率</button>
							<button type="button" data-toggle="modal" @click="set_ele_powerlimit()" data-target="#set_price" class="btn btn-info">设置电价</button>
						</div>
						<div class="modal-footer">
							<button type="button" id="ele_on_Off_1" @click="ele_on_Off(1,'#ele_on_Off_1')" class="btn btn-danger">开闸(断电)</button>
							<button type="button" id="ele_on_Off_2" @click="ele_on_Off(2,'ele_on_Off_2')" class="btn btn-danger">关闸(送电)</button>
							<button type="button" id="openEleAccount" @click="open_ele_account('openEleAccount')" data-toggle="modal" data-target="#sure_open_account1" class="btn btn-danger">开户</button>
							<button type="button" id="offEleAccount" @click="open_ele_account('offEleAccount')" data-toggle="modal" data-target="#sure_open_account1" class="btn btn-danger">销户</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）设置电价  -->
			<div class="modal fade" id="set_price" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">设置电价</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*表类型：</span>
									<select id="" v-model="set_data.issetprice" style="display: inline-block;" class="form-control">
										<option value="">请选择计费类型</option>
										<option value="1">单价</option>
										<option value="2">阶梯价</option> -->
									</select>
								</li>
								<li>
									<span>生效时间:</span><input placeholder="请选择生效时间" v-model="set_data.datetime" type="text" size="16" class="form-control form_datetime">
								</li>
								<!--单价-->
								<li v-if="set_data.issetprice==1">
									<span>单价</span><input type="number" v-model="set_data.price1" placeholder="请输入电价" />
								</li>
								<!--多项-->
								<div v-if="set_data.watchtype==2">
									<li>
										<span>尖电价</span><input type="number" v-model="set_data.price1" placeholder="请输入电价" />
									</li>
									<li>
										<span>峰电价</span><input type="number" v-model="set_data.price2" placeholder="请输入电价" />
									</li>
									<li>
										<span>平电价</span><input type="number" v-model="set_data.price3" placeholder="请输入电价" />
									</li>
									<li>
										<span>谷电价</span><input type="number" v-model="set_data.price4" placeholder="请输入电价" />
									</li>
								</div>

								<!--阶梯 -->
								<div v-if="set_data.issetprice==2">
									<li>
										<span>价格1</span><input type="number" v-model="set_data.price1" placeholder="请输入电价" />
									</li>
									<li>
										<span>价格2</span><input type="number" v-model="set_data.price2" placeholder="请输入电价" />
									</li>
									<li>
										<span>价格3</span><input type="number" v-model="set_data.price3" placeholder="请输入电价" />
									</li>
									<li>
										<span>价格4</span><input type="number" v-model="set_data.price4" placeholder="请输入电价" />
									</li>
									<li>
										<span>阶梯1</span><input type="text" v-model="set_data.ladder1" placeholder="请输入阶梯" />
									</li>
									<li>
										<span>阶梯2</span><input type="text" v-model="set_data.ladder2" placeholder="请输入阶梯" />
									</li>
									<li>
										<span>阶梯3</span><input type="text" v-model="set_data.ladder3" placeholder="请输入阶梯" />
									</li>
								</div>

							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="sure_ele_setprise" @click="sure_ele_setprise('#sure_ele_setprise')" class="btn btn-danger">确定</button>

						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）设置功率  -->
			<div class="modal fade" id="set_powerlimit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">设置功率</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>功率</span><input type="number" v-model="powerlimit" placeholder="请输入功率（KW）" />
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="sure_ele_set_powerlimit" @click="sure_ele_set_powerlimit('#sure_ele_set_powerlimit')" class="btn btn-danger">确定</button>

						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>

			<!-- 模态框（Modal）读电表-->
			<div class="modal fade" id="read_ele_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">读电表数据</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<button id="read_voltage" @click="read_meter(1,'#read_voltage')" type="button" class="btn btn-info">读电压</button>
								</li>
								<li v-if="read_data.voltage">
									<span>电压：</span><label v-text="read_data.voltage+' V'"></label>
								</li>
								<li>
									<button id="read_current" @click="read_meter(2,'#read_current')" type="button" class="btn btn-info">读电流</button>
								</li>
								<li v-if="read_data.current">
									<span>电流：</span><label v-text="read_data.current+' A'"></label>
								</li>
								<li>
									<button id="read_currentpower" @click="read_meter(3,'#read_currentpower')" type="button" class="btn btn-info">读功率</button>
								</li>
								<li v-if="read_data.currentpower">
									<span>功率：</span><label v-text="read_data.currentpower+' KW'"></label>
								</li>
								<li>
									<button id="read_biao" @click="read_meter(4,'#read_biao')" type="button" class="btn btn-info">读表</button>
								</li>
								<li v-if="read_data.totalprice">
									<span>总购金额 :</span><label v-text="read_data.totalprice+' 元'"></label>
								</li>
								<li v-if="read_data.balance">
									<span>余额 :</span><label v-text="read_data.balance +'元'"></label>
								</li>
								<li v-if="read_data.charegcount">
									<span>充值次数 :</span><label v-text="read_data.charegcount+'次'"></label>
								</li>
								<li>
									<button id="read_tieredpricing" @click="read_meter(5,'#read_tieredpricing')" type="button" class="btn btn-info">读电价</button>
								</li>
								<li>
									<span>生效时间 :</span><label v-text="read_data.tieredpricing.datetime"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯一:</span><label v-text="read_data.tieredpricing.ladder1"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯二:</span><label v-text="read_data.tieredpricing.ladder2"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯三:</span><label v-text="read_data.tieredpricing.ladder3"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯价格 1:</span><label v-text="read_data.tieredpricing.price1+'元'"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯价格 2:</span><label v-text="read_data.tieredpricing.price2+'元'"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯价格 3:</span><label v-text="read_data.tieredpricing.price3+'元'"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>阶梯价格 4:</span><label v-text="read_data.tieredpricing.price4+'元'"></label>
								</li>
								<li v-if="read_data.kind==1">
									<span>备注：</span><textarea disabled="disabled" v-text="read_data.remarks"></textarea>
								</li>
								<li v-if="read_data.kind==2">
									<span>尖电价：</span><label v-text="read_data.tieredpricing.price1+'元'"></label>
								</li>
								<li v-if="read_data.kind==2">
									<span>峰电价：</span><label v-text="read_data.tieredpricing.price2+'元'"></label>
								</li>
								<li v-if="read_data.kind==2">
									<span>平电价：</span><label v-text="read_data.tieredpricing.price3+'元'"></label>
								</li>
								<li v-if="read_data.kind==2">
									<span>谷电价：</span><label v-text="read_data.tieredpricing.price4+'元'"></label>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）提示信息 -->
			<div class="modal fade" style="z-index: 1052;" id="myModal_tips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">提示信息</h4>
						</div>
						<div class="modal-body" id="tips" v-text="tips_modal">

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
			<!-- 确认删除 -->
			<div style="z-index: 1048;" class="modal fade" id="remove_ele_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">是否确认删除</h4>
						</div>
						<div class="modal-body">删除后数据无法找回</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" class="btn btn-danger remove" @click="sureremove">确定删除</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 确认开户/销户 -->
			<div style="z-index: 1051;" class="modal fade" id="sure_open_account1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel" v-text="'是否确认'+openEleAccount"></h4>
						</div>
						<!--<div class="modal-body">删除后数据无法找回</div>-->
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="sure_open_account" class="btn btn-danger remove" v-text="'确认'+openEleAccount" @click="sure_open_account('#sure_open_account')"></button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>

		</div>

	</body>

</html>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.zh-CN.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/fileinput.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/zh.js" type="text/javascript" charset="utf-8"></script>
<script>
	//	var urlr = "http://192.168.0.30:8085"
	new Vue({
		el: '#app',
		data: {
			val_te: "",
			urlr: "",
			current: 1,
			showItem: 5,
			rechresult: "",
			allpage: "",
			jump: "",
			userid: "",
			model_data: "",
			show_caozuo: false,
			tips_modal: "",
			createusername: "",
			areaid: "",
			start: "",
			end: "",
			data_remove: "",
			vendor: "",
			imgpath: "",
			replace_data: {
				initsum: 0,
				remarks: "",
				watchno: "",
				oldwatchpic: "",
				equipsid: "",
				modifyuserid: "",
				modifyusername: "",
			},
			openEleAccount: "",
			imgpath_fix: "",
			vendor_name: [{
				id: "请选择厂商名字",
				areaname: "请选择厂商名字"
			}],
			set_data: {
				equipsid: "",
				issetprice: '',
				datetime: "",
				price1: "",
				price2: "",
				price3: "",
				price4: "",
				ladder1: "",
				ladder2: "",
				ladder3: "",
			},
			searchmain: "",
			powerlimit: '',
			panduan: true,
			token: "",
			merchantid: "",
			goodsid: '',
			count_all: "",
			get_upload: "",
			fix_data: {
				instadr: '',
			},
			watchtype1: "",
			read_data: {
				balance: "",
				charegcount: "",
				current: "",
				voltage: "",
				currentpower: "",
				totalprice: "",
				tieredpricing: {
					datetime: "",
					ladder1: "",
					ladder2: "",
					ladder3: "",
					price1: "",
					price2: "",
					price3: "",
					price4: "",
				},
			},
			urll: "",
			add_data: {

			},
			leixing: [{
				name: '全部',
				id: ""
			}, {
				name: '充值成功',
				id: "1"
			}, {
				name: '充值失败',
				id: "2"
			}, {
				name: '充值中',
				id: "3"
			}, ],
			leixing_model: "",
			watchtype: 0,
			payid: "",
			jifei: [{
					id: 1,
					value: '单项'
				},
				{
					id: 2,
					value: '三项'
				},

			],
			lou: [{
				buildname: '请选择楼宇',
				id: ""
			}],
			lou_model: "",
			danyuan: [{
				unitname: '请选择单元',
				id: ""
			}],
			danyuan_model: '',
			table: [{

				},

			],
			mac_name: "",
			build: [{
				buildname: '请选择楼宇',
				id: ""
			}],
			build_model: "",
			unit: [{
				unitname: '请选择单元',
				id: ""
			}],
			unit_model: '',
			floor: [{
				floorname: '请选择楼层',
				id: ""
			}],
			floor_model: '',
			room: [{
				rommcode: '请选择房号',
				rommid: ""
			}],

			room_model: '',
		},
		//计算属性
		computed: {

		},
		created: function() {
			var that = this;
			var aa = getUrl();
			that.urlr = aa;
			that.build_model = that.build[0].id;
			that.unit_model = that.unit[0].id;
			that.floor_model = that.floor[0].id;
			that.room_model = that.room[0].rommid;
			that.get_upload = get_upload();

		},
		mounted: function() {
			var that = this;
			this.lou_model = this.lou[0].id;
			this.danyuan_model = this.danyuan[0].id;
			this.leixing_model = this.leixing[0].id;
			var userid = getUrlParam('userid');
			this.userid = userid;
			var createusername = getUrlParam('realname');
			that.createusername = createusername;
			var merchantid = getUrlParam('merchantid');
			this.merchantid = merchantid;
			var areaid = getUrlParam('areaid');
			this.areaid = areaid;
			var token = getUrlParam('token');
			this.token = token;
			var goodsid = getUrlParam('goodsid');
			this.goodsid = goodsid;
			if(userid == null || userid == '') {
				this.tips_modal = "用户id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(createusername == null || createusername == '') {
				this.tips_modal = "用户姓名不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(areaid == null || areaid == '') {
				this.tips_modal = "小区id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(merchantid == null || merchantid == '') {
				this.tips_modal = "物业id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(goodsid == null || goodsid == '') {
				this.tips_modal = "goodsid不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			that.build_model = that.build[0].id;
			that.unit_model = that.unit[0].id;
			that.floor_model = that.floor[0].id;
			that.room_model = that.room[0].rommid;
			//日期初始化
			$('.form_datetime').datetimepicker({
				format: 'mm-dd',
				autoclose: true,
				todayBtn: true,
				startView: 'month',
				minView: 'month',
				maxView: 'decade',
				language: 'zh-CN',
			});
			var now = new Date();
			var aa = now.setDate(now.getDate() + 1);
			//设置开始日期为今天之后			
			$('.form_datetime').datetimepicker('setStartDate', new Date(aa));
			$('.form_datetime').datetimepicker('setEndDate', '3099-01-01');
			//选择框隐藏赋值
			$(".form_datetime").datetimepicker().on('hide', function(ev) {
				var startTime = $(".form_datetime").val();
				that.set_data.datetime = startTime;
			});
			var datainit = {
				pagenumber: 1,
				pagesize: 10,
				areaid: this.areaid,
				buildid: this.build_model,
				unitid: this.unit_model,
				rommid: this.room_model,
				floor: this.floor_model,
				selectinfo: this.searchmain,
			};
			if(this.val_te != true) {
				this.jiazai(datainit);
				this.lou_info(this.areaid)
				this.table = ""
			}
			that.upload_img();
			that.upload_img1();
			that.data_time_init();
			that.get_choose_mac_adder();
		},
		computed: {
			pages: function() {
				var pag = [];
				if(this.current < this.showItem) { //如果当前的激活的项 小于要显示的条数
					//总页数和要显示的条数那个大就显示多少条
					var i = Math.min(this.showItem, this.allpage);
					while(i) {
						pag.unshift(i--);
					}
				} else { //当前页数大于显示页数了
					var middle = this.current - Math.floor(this.showItem / 2), //从哪里开始
						i = this.showItem;
					if(middle > (this.allpage - this.showItem)) {
						middle = (this.allpage - this.showItem) + 1
					}
					while(i--) {
						pag.push(middle++);
					}
				}
				return pag
			},
		},
		methods: {
			//提示
			tips: function(data) {
				var that = this;
				that.tips_modal = data;
				$('#myModal_tips').modal('show');
			},
			//日期
			data_time_init: function() {
				var d, s;
				var self = this;
				self.start = s;
				$('#datetimepicker').datetimepicker({
					minView: "month", //选择日期后，不会再跳转去选择时分秒 
					language: 'zh-CN',
					format: 'yyyy-mm-dd',
					todayBtn: 1,
					autoclose: 1,
				});
				//隐藏的同时绑定数据
				$("#datetimepicker").datetimepicker().on('hide', function(ev) {
					var startTime = $("#datetimepicker").val();
					self.add_data.instdate = startTime;
				});

			},
			//获取楼宇
			lou_info: function(areaid) {
				var that = this;
				var data = JSON.stringify({
					parentid: that.areaid
				})
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/public/selectBuildList",
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var aa = JSON.parse(msg.returnString);
							var te = {
								buildname: '请选择楼宇',
								id: ""
							}
							aa.unshift(te);
							that.build = aa;
							that.build_model = that.build[0].id;
						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//楼改变请求单元
			buildchange: function() {
				this.unil_info(this.build_model);
			},
			//获取单元
			unil_info: function(areaid) {
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectUnitsList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									unitname: '请选择单元',
									id: ""
								}
								aa.unshift(te);
								that.unit = aa;
								that.unit_model = that.unit[0].id;
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			/*单元改变*/
			unitchange: function() {
				this.floor_info(this.unit_model);
			},
			//获取楼层
			floor_info: function(areaid) {
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectFloors",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									floorname: '请选择楼层',
									id: ""
								}
								var flloor = [];
								for(var i = 1; i <= aa; i++) {
									var main = {
										floorname: i + "层",
										id: i
									}
									flloor.push(main)
								}
								flloor.unshift(te);
								that.floor = flloor;
								that.floor_model = that.floor[0].id;
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			//楼层改变
			floorchange: function() {
				var that = this;
				if(this.unit_model == '' || this.floor_model == '') {
					var aa = [];
					var te = {
						rommcode: '请选择房号',
						rommid: ""
					}
					aa.unshift(te);
					that.room = aa;
					that.room_model = that.room[0].rommid;
				} else {
					this.room_info(this.unit_model, this.floor_model);
				}
			},
			//出现房屋
			room_info: function(areaid, floor_c) {
				if(areaid != "" || floor_c != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid,
						floor: floor_c
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",

						type: "POST",
						url: that.urlr + "/public/selectRoomCodeList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									rommcode: '请选择房号',
									rommid: ""
								}
								aa.unshift(te);
								that.room = aa;
								that.room_model = that.room[0].rommid;
							} else {
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}
			},
			//加载数据
			jiazai: function(e) {
				//				console.log(e)			
				var data = JSON.stringify(e);
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/selectEleInfoList",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var data = JSON.parse(msg.returnString);
//							console.log(data);

							for(var i = 0; i < data.length; i++) {
								if(data[i].watchstate == 1) {
									data[i].watchstate = '正常'
								} else if(data[i].watchstate == 2) {
									data[i].watchstate = "未开闸"
								}

								if(data[i].issetprice == 0) {
									data[i].issetprice = '未设置 '
								} else if(data[i].issetprice == 1) {
									data[i].issetprice = "已设置"
								}
								if(data[i].accountstate == 1) {
									data[i].accountstate = '已开户'
								} else if(data[i].accountstate == 0) {
									data[i].accountstate = "未开户"
								}
								if(data[i].watchtype == 1) {
									data[i].watchtype = '单项'
								} else if(data[i].watchtype == 2) {
									data[i].watchtype = "三项"
								}
								if(data[i].rechresult == 1) {
									data[i].rechresult1 = "充值成功"
								} else if(data[i].rechresult == -1) {
									data[i].rechresult1 = "充值失败 "

								} else if(data[i].rechresult == 0) {
									data[i].rechresult1 = "充值中"
								}
								if(data[i].billstatus == 1) {
									data[i].billstatus = "已完成(成功支付)"
								} else if(data[i].billstatus == 2) {
									data[i].billstatus = "已取消 "
								} else if(data[i].billstatus == 3) {
									data[i].billstatus = "已退款"
								} else if(data[i].billstatus == 4) {
									data[i].billstatus = "缴费失败，已退款"
								} else if(data[i].billstatus == 5) {
									data[i].billstatus = "缴费失败，系统自主退款失败"
								}

							}

							that.table = data;
							that.count_all = "共" + msg.count + "条"
							var yu = msg.count % 10;
							if(yu == 0) {
								that.allpage = parseInt(msg.count / 10);
							} else {
								that.allpage = parseInt(msg.count / 10) + 1;
							}

						} else {
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});

			},
			//跳页
			goto: function(index) {
				if(index == this.current) return;
				if(index > this.allpage) {
					return
				}
				//				debugger
				var re = /^[1-9]+[0-9]*]*$/ //判断正整数      // /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字  
				if(!re.test(index)) {
					return false;
				}
				this.current = index;
				var datainit = {
					pagenumber: index,
					pagesize: 10,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.room_model,
					floor: this.floor_model,
					selectinfo: this.searchmain,

				};

				this.jiazai(datainit);
				//这里可以发送ajax请求
			},
			//搜索
			search: function() {
				var that = this;
				var datainit = {
					pagenumber: 1,
					pagesize: 10,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.room_model,
					floor: this.floor_model,
					selectinfo: this.searchmain,

				}
				if(that.val_te != true) {
					this.jiazai(datainit);
					that.current=1;
				} else {
					//					alert("非法登录");
					that.tips_modal = "非法登录";
					$('#myModal_tips').modal('show');
				}

			},
			//详情
			sure_more: function(data) {
				//				console.log(data)
				var that = this;
				that.model_data = data;
			},
			//获取厂商名字
			get_vendor_name: function() {
				var that = this;
				that.vendor = that.vendor_name[0].id;
				var data = JSON.stringify({
					fullname: "",
					requestString: JSON.stringify({
						itemname: "电表厂商名字"
					}),
					userId: ''
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + '/public/selectDataItemByItemcode',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
//						console.log(msg)
						if(msg.responseCode == 200) {
//							console.log(msg)
							that.vendor_name = JSON.parse(msg.returnString);
							that.vendor_name.unshift({
								id: "请选择厂商名字",
								itemname: "请选择厂商名字"
							});
							that.vendor = that.vendor_name[0].id;
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//获取mac板子
			get_choose_mac_adder: function() {
				var that = this;
				that.vendor = that.vendor_name[0].id;
				var data = JSON.stringify({
					areaid: that.areaid
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + '/verify/elepro/chooseMacAdder',
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
//						console.log(msg)
						if(msg.code == 200) {
//							console.log(msg)
							that.mac_name = JSON.parse(msg.returnString);
							that.mac_name.unshift({
								macadderid: "",
								boardname: "请选择mac板"
							});
							that.add_data.macadderid = that.mac_name[0].macadderid;
						} else {
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//上传照片
			upload_img: function() {
				var that = this;
				$("#uploadfile").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.get_upload + "/woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.imgpath = bb[0].url;
//					console.log(that.imgpath);
				});
			},
			//修改上传照片
			upload_img1: function() {
				var that = this;
				$("#uploadfile1").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.get_upload + "/woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.imgpath_fix = bb[0].url;
//					console.log(that.imgpath_fix);
				});
			},
			//增加电表
			add_ele_meter: function() {
				var that = this;
				that.watchtype = "";
				that.get_vendor_name();
			},
			//确定增加
			add_ele_meter_sure: function() {
				var that = this;
				that.add_data.rommid = that.room_model;
				that.add_data.oldwatchpic = that.imgpath;
				that.add_data.factoryid = that.vendor;
				that.add_data.createuserid = that.userid;
				that.add_data.createusername = that.createusername;
				that.add_data.watchtype = that.watchtype;
				if(that.add_data.rommid == '') {
					that.tips("请先选择房间");
					return;
				}
				if(that.add_data.factoryid == '请选择厂商名字') {
					that.tips("请选择厂商名字");
					return;
				}
				if(that.add_data.instdate == '') {
					that.tips("请先选择安装时间");
					return;
				}
				if(that.add_data.watchno == '') {
					that.tips("请先输入新表号");
					return;
				}
				if(that.add_data.instadr == '') {
					that.tips("请先选择安装位置");
					return;
				}
				if(that.add_data.watchtype == '') {
					that.tips("请先选择表类型");
					return;
				}
				if(that.add_data.ipadder == '') {
					that.tips("请先选择ip地址");
					return;
				}
				if(that.add_data.macadderid == '') {
					that.tips("请先选择mac地址");
					return;
				}
				if(that.add_data.port == '') {
					that.tips("请先选择表类型");
					return;
				}
				if(that.add_data.watchtype == 1) {
					that.add_data.rate = "";
				} else if(that.add_data.watchtype == 2) {
					if(that.add_data.rate == '') {
						that.tips("请先选择三项表倍率");
						return;
					}
				}
				var data = JSON.stringify(that.add_data);
//				console.log(data);
				$('#add_ele_meter_sure').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/addEleWatch",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#add_ele_meter_sure').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("添加成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#add_ele_meter_sure').attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//点击修改页面数据回显
			fix_ele_meter: function(data) {
//				console.log(data)
				var that = this;
				that.fix_data.watchtype = data.watchtype;
				that.fix_data.equipsid = data.equipsid;
				that.fix_data.macadderid = data.macadderid;
				that.fix_data.instadr = data.instadr;
				that.fix_data.ipadder = data.ipadder;
				that.fix_data.port = data.port;
				that.fix_data.remarks = data.remarks;
				//				that.fix_data.oldwatchno = data.oldwatchno;
				//				that.fix_data.watchtype = data.watchtype;
				that.fix_data.rate = data.rate;
				if(that.fix_data.watchtype == '单项') {
					that.watchtype1 = 1;
				} else if(that.fix_data.watchtype == '三项') {
					that.watchtype1 = 2;
				}
			},
			//点击确定修改
			fix_ele_meter_sure: function() {
				var that = this;
				//				that.fix_data.oldwatchpic = that.imgpath1;
				that.fix_data.watchtype = that.watchtype1;
				that.fix_data.modifyuserid = that.userid;
				that.fix_data.modifyusername = that.createusername;
				$('#fix_ele_meter_sure').attr('disabled', true);
				//				console.log(that.fix_data);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/updateEle",
					data: JSON.stringify(that.fix_data),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#fix_ele_meter_sure').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("修改成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#fix_ele_meter_sure').attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//删除
			remove_ele_meter: function(tt) {
//				console.log(tt)
				var that = this;
				that.data_remove = {
					equipsid: tt.equipsid,
					modifyuserid: that.userid,
					modifyusername: that.createusername
				};
			},
			//删除电表
			sureremove: function() {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/deleteEle",
					data: JSON.stringify(that.data_remove),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.code == 200) {
//							console.log(msg)
							that.tips("删除成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//点击跟换电表
			replace_ele_meter: function(data) {
//				console.log(data.remarks);
				var that = this;
				that.replace_data.remarks = data.remarks;
				that.replace_data.equipsid = data.equipsid;
//				console.log(that.replace_data);
			},
			//确定更换
			replace_ele_meter_sure: function() {
				var that = this;
				if(that.replace_data.watchno == '') {
					that.tips("请先输入新表号");
					return
				}
//				console.log(that.replace_data)
				that.replace_data.oldwatchpic = that.imgpath_fix;
				that.replace_data.modifyuserid = that.userid;
				that.replace_data.modifyusername = that.createusername;
				$('#replace_ele_meter_sure').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/eleChange",
					data: JSON.stringify(that.replace_data),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#replace_ele_meter_sure').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("更换成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#replace_ele_meter_sure').attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//点击进去    置空 数据
			read_metera_action: function() {
				var that = this;
				that.read_data = {
					balance: "",
					charegcount: "",
					current: "",
					voltage: "",
					currentpower: "",
					totalprice: "",
					tieredpricing: {
						datetime: "",
						ladder1: "",
						ladder2: "",
						ladder3: "",
						price1: "",
						price2: "",
						price3: "",
						price4: "",
					},
				}
			},
			//读电表
			read_meter: function(num, id_1) {
				$(id_1).attr('disabled', true);
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid,
					cmdtype: num
				})
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/selectEleInfo",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$(id_1).attr('disabled', false);
						if(msg.code == 200) {
							var msg = JSON.parse(msg.returnString);
//							console.log(msg)
//							console.log(that.model_data.watchtype)

							if(num == 1) {
								that.read_data.voltage = msg.voltage;
							}
							if(num == 2) {
								that.read_data.current = msg.current;
							}
							if(num == 3) {
								that.read_data.currentpower = msg.currentpower;
							}
							if(num == 4) {
								that.read_data.balance = msg.balance;
								that.read_data.charegcount = msg.charegcount;
								that.read_data.totalprice = msg.totalprice;
							}
							if(num == 5) {
								that.read_data.tieredpricing = JSON.parse(msg.tieredpricing);
								if(that.model_data.watchtype == "单项") {
									that.read_data.kind = 1;
								} else if(that.model_data.watchtype == "三项") {
									that.read_data.kind = 2;
								}
							}
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$(id_1).attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//开关闸
			ele_on_Off: function(watchstate, id_1) {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid,
					watchstate: watchstate
				});
				$(id_1).attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/eleCutOff",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$(id_1).attr('disabled', false);
						if(msg.code == 200) {
//							console.log(msg)
							//							var msg = JSON.parse(msg.returnString);
							that.tips("操作成功");
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$(id_1).attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//开户销户
			open_ele_account: function(urll) {

				var that = this;
				that.urll = urll;
				//				
				if(urll == 'openEleAccount') {
					that.openEleAccount = '开户'
				} else if(urll == 'offEleAccount') {
					that.openEleAccount = '销户'
				}
			},
			//确认开户、销户
			sure_open_account: function(id_1) {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid,
				});
				$(id_1).attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/" + that.urll,
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$(id_1).attr('disabled', false);
						if(msg.code == 200) {
							$("#sure_open_account1").modal('hide');
//							console.log(msg); //							
							that.tips("操作成功");
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$(id_1).attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//设置电价点开
			set_ele_prise: function() {
				var that = this;
				var watchtype = that.model_data.watchtype;
				if(watchtype == '单项') {
					that.set_data.watchtype = 1;
				} else if(watchtype == '三项') {
					that.set_data.watchtype = 2;
				}
			},
			//确定设置电价
			sure_ele_setprise: function(id_1) {
				var that = this;
				if(that.set_data.issetprice == 1) {
					that.set_data.price2 = '';
					that.set_data.price3 = '';
					that.set_data.price4 = '';
					that.set_data.ladder1 = '';
					that.set_data.ladder2 = '';
					that.set_data.ladder3 = '';
				}
				if(that.set_data.watchtype == 2) {
					that.set_data.ladder1 = '';
					that.set_data.ladder2 = '';
					that.set_data.ladder3 = '';
				}
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid,
					issetprice: that.set_data.issetprice,
					datetime: that.set_data.datetime,
					price1: that.set_data.price1,
					price2: that.set_data.price2,
					price3: that.set_data.price3,
					price4: that.set_data.price4,
					ladder1: that.set_data.ladder1,
					ladder2: that.set_data.ladder2,
					ladder3: that.set_data.ladder3,
				});
//				console.log(data)
				$(id_1).attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/setElePricing",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$(id_1).attr('disabled', false);
						if(msg.code == 200) {
							$("#set_price").modal('hide');
//							console.log(msg); //							
							that.tips("设置电价成功");
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$(id_1).attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			//设置功率			
			sure_ele_set_powerlimit: function(id_1) {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid,
					powerlimit: that.powerlimit
				});
				$(id_1).attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/setElePower",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$(id_1).attr('disabled', false);
						if(msg.code == 200) {
							$("#set_powerlimit").modal('hide');
//							console.log(msg); //							
							that.tips("设置功率成功");
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						$(id_1).attr('disabled', false);
						that.tips("获取信息失败");
					}
				});
			},
			/*群读电表 */
			grou_read_meter: function() {
				var that = this;
				if(that.unit_model == '') {
					that.tips('请先选择群读电表的范围，最大范围为单元！');
					return
				}
				var data = JSON.stringify({
					build: that.build_model,
					unitid: that.unit_model,
					userid: that.userid,
					rommid: that.room_model,
					floor: that.floor_model,
					selectinfo: that.searchmain
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/elepro/readGroupEle",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.code == 200) {
//							console.log(msg);
							that.tips("群读电表操作请求成功，将会为您跳转查询页面，请耐心等待！");
							$('#myModal_tips').on('hide.bs.modal', function() {
								var url_can = location.search;
								window.location.href = 'Meter_interactive_record.html' + url_can;
							})
							//sessionStorage.getItem("data_search")
							//sessionStorage.setItem("data_xs", data_sess);
							var data_search = data;
							sessionStorage.setItem("data_search", data_search);
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {

						that.tips("获取信息失败");
					}
				});
			}
		},

	})
</script>